<?php

class driver_career
{
	var $events_data;
	var $champ_data;
	var $first;
		

	function driver_career($champ_data, $events_data, $first)
	{
		$this->events_data = $events_data;
		$this->champ_data = $champ_data;
		$this->first = $first;
	}
	
	function render()
	{
		global $skin_dir, $lang;
		$remBufferStart = $this->first ? '<!--' : '';
		$remBufferEnd = $this->first ? '-->' : '';
		$champ_logo =  $this->champ_data['champ_logo'] == '' ? '' : '<a href="championships.php?id=' . $this->champ_data['champ_id'] . 
							'"><img src="' . $this->champ_data['champ_logo'] . '"/></a>';
		$champ_title = '<a href="championships.php?id=' . $this->champ_data['champ_id'] . '">' . $this->champ_data['champ_title'] . '</a>';
		$champ_team = stripslashes($this->champ_data['team_id'] == 0 ? $lang['Independent'] :  '<a href="teams.php?id=' . $this->champ_data['team_id'] 
					 . '">' . $this->champ_data['team_name'] . '</a>');
		$champ_car = ($this->champ_data['cs_no'] <= 0 ? '' : '#' . $this->champ_data['cs_no'] . ' ' ) .
					($this->champ_data['car_id'] == 0 ? $lang['Unassigned'] : $this->champ_data['car_manufacturer'] .' '. $this->champ_data['car_model']);
		
		$car_image = $this->champ_data['cs_imageThmb'] == '' ? '' : '<a href="' . $this->champ_data['cs_image']  . '" rel="lightbox[champimages]" title="' . 					$champ_car . '"><img src="' . $this->champ_data['cs_imageThmb'] . '"/></a>';
		
		$champ_car = $this->champ_data['car_id'] <= 0 ? $champ_car : '<a href="cars.php?id=' . $this->champ_data['car_id'] . '">' . $champ_car . '</a>';
					
		include $skin_dir . 'tpl/driverChampionship.tpl';
		
		foreach($this->events_data as $event)
		{
			$event_date = $event['event_date'];
			$event_location = $event['track_location'];
			$event_name = '<a href="events.php?id=' . $event['e_id'] . '">' . $event['d_title'] . ' ' . $event['e_title'] . ': ' . 
							$event['track_name'] . '</a>';
			include $skin_dir . 'tpl/driverEvent.tpl';
		}
		
	}
	
}

?>